home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Id: tel_iacout.c,v 3.1 1994/05/14 14:17:07 ppessi Exp $
- *
- * Author: Tomi Ollila <too@cs.hut.fi>
- *
- * Copyright © 1993, 1994 AmiTCP/IP Group, <amitcp-group@hut.fi>
- * Helsinki University of Technology, Finland.
- * All rights reserved.
- *
- * Created: Thu Apr 7 18:18:03 1994 too
- * Last modified: Fri May 13 04:42:56 1994 ppessi
- *
- * HISTORY
- * $Log: tel_iacout.c,v $
- * Revision 3.1 1994/05/14 14:17:07 ppessi
- * initial revision
- *
- * Revision 3.1 1994/04/17 11:31:54 too
- * initial revision
- *
- */
-
- #include "telnet.h"
- #include <arpa/telnet.h>
- #include "tel_iacout.h"
-
- u_char telnet_iacbuf[36]; /* buffer for negotiation replies */
- short telnet_iaclen; /* bytes in buffer above */
-
- void putiac2(u_char wwdd, u_char c)
- {
- if (telnet_iaclen + 3 > sizeof telnet_iacbuf)
- doIacflush();
-
- telnet_iacbuf[telnet_iaclen++] = IAC;
- telnet_iacbuf[telnet_iaclen++] = wwdd;
- telnet_iacbuf[telnet_iaclen++] = c;
- }
-
- void putiac1(u_char c)
- {
- if (telnet_iaclen + 2 > sizeof telnet_iacbuf)
- doIacflush();
-
- telnet_iacbuf[telnet_iaclen++] = IAC;
- telnet_iacbuf[telnet_iaclen++] = c;
- }
-
- void putiacstring(u_char wwdd, const u_char * str)
- {
- size_t len;
-
- iacflush();
-
- telnet_iacbuf[telnet_iaclen++] = IAC;
- telnet_iacbuf[telnet_iaclen++] = SB;
- telnet_iacbuf[telnet_iaclen++] = wwdd;
- telnet_iacbuf[telnet_iaclen++] = TELQUAL_IS;
-
- len = strlen(str);
- if (len <= sizeof telnet_iacbuf - 6) {
- strcpy(telnet_iacbuf + telnet_iaclen, str);
- telnet_iaclen += len;
- } else {
- iacflush();
- send(rsock, str, len, 0);
- }
- telnet_iacbuf[telnet_iaclen++] = IAC;
- telnet_iacbuf[telnet_iaclen++] = SE;
- }
-
-
-